/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 刘远望
 * Date: 2025-05-13
 * Time: 19:26
 */
//3335字符串转换后的长度
public class Soulution {
    public static int MOD = (int)1e9 + 7;
    public int lengthAfterTransformations(String s, int t) {
        char[] str = s.toCharArray();

        int[] count =new int[26];
        for (char x : str) {
            count[x - 'a']++;
        }

        for (int i = 0; i < t; i++) {
            int countZ = count[25];
            for (int j = 25; j > 0; j--) {
                count[j] = count[j - 1];
            }

            //将a的个数等于z
            count[0] = countZ;
            //将b的个数再加上z的个数
            count[1] = (count[1] + countZ) % MOD;
        }

        int ans = 0;
        for (int i = 0; i < 26; i++) {
            ans = (ans + count[i]) % MOD;
        }
        return ans;
    }
}
